<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload = function () {
            var h1 = document.createElement("h1")
            var sz = document.createTextNode("深圳")
            h1.appendChild(sz)

            var foundAllButtonTag = document.getElementById("foundAllButtonTag")
            var body = document.getElementById("body")
            //向foundAllButtonTag标签前面插入h1标签
            body.insertBefore(h1,foundAllButtonTag)
            //移除某个标签
            body.removeChild(foundAllButtonTag)
        }

        function foundAllButtonTag() {
            var buttonTag = document.getElementsByTagName("button")
            //遍历所有的button标签
            for (var i = 0; i < buttonTag.length; i++) {
                var argument = buttonTag[i];
                //设置标签的属性
                argument.setAttribute("value","nishishui");
                //获取标签的属性
                console.log(argument.getAttribute("value") +"===="+argument.name);
            }
        }

    </script>
</head>
<body id="body">
    <button id="username" name="username1" onclick="clicktet()" value="12">点击我1</button>
    <button id="password" name="password1" value="122">点击我2</button>
    <button id="age" name="age2" value="212">点击我3</button>

    <h1 id="foundAllButtonTag" onclick="foundAllButtonTag()">获取所有button标签的属性</h1>


    <input type="radio" checked="checked">男
    <input type="checkbox" checked="checked">足球
</body>
</html>